﻿/*
    Using loops write a program that converts an integer number to its binary representation.
    The input is entered as long. The output should be a variable of type string.
    Do not use the built-in .NET functionality.
 */


using System;

class DecimalToBinary
{
    static void Main()
    {
        long decNumber;
        Console.Write("Enter a Number : ");
        decNumber = long.Parse(Console.ReadLine());
        long decNumberDivide;

        string result = "";

        while (decNumber >= 1)
        {
            decNumberDivide = decNumber / 2;
            result += (decNumber % 2).ToString();
            decNumber = decNumberDivide;
        }
        
        string binNumber = "";
        for (int i = result.Length - 1; i >= 0; i--)
        {
            binNumber = binNumber + result[i];

        }

        Console.WriteLine(binNumber);
    }
}
